package Demo03;

public class computer {
    public void open(){
        System.out.println("开机！！");
    }

    public void close(){
        System.out.println("关机！！");
    }

    public void useDevice(iusb usb){
        usb.openDevice();
        if(usb instanceof mouse){
            mouse m=(mouse)usb;
            m.click();
        }else if(usb instanceof keyboard){
            keyboard k=(keyboard) usb;
            k.input();
        }
        usb.closeDevice();

    }

}




